{% extends "admin/layout.html" %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-6">
            <div class="card">
                <div class="card-header">
                    <h4>修改密码</h4>
                </div>
                <div class="card-body">
                    <form method="POST" action="{{ url_for('admin.admin_user.change_password') }}">
                        <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

                        <div class="form-group mb-3">
                            <label for="current_password" class="form-label">当前密码</label>
                            <input type="password" class="form-control" id="current_password" name="current_password" required>
                            {% if error and error == 'current_password' %}
                                <div class="invalid-feedback d-block">当前密码不正确</div>
                            {% endif %}
                        </div>

                        <div class="form-group mb-3">
                            <label for="new_password" class="form-label">新密码</label>
                            <input type="password" class="form-control" id="new_password" name="new_password" required>
                        </div>

                        <div class="form-group mb-3">
                            <label for="confirm_password" class="form-label">确认新密码</label>
                            <input type="password" class="form-control" id="confirm_password" name="confirm_password" required>
                            {% if error and error == 'password_mismatch' %}
                                <div class="invalid-feedback d-block">新密码与确认密码不匹配</div>
                            {% endif %}
                        </div>

                        <div class="d-grid gap-2 d-md-flex justify-content-md-end">
                            <button type="submit" class="btn btn-primary">保存</button>
                            <a href="{{ url_for('admin.dashboard') }}" class="btn btn-secondary">取消</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}